Skip to content

fix(logs): preserve false in named parameters - #1264

Merged
solnic merged 1 commit into
getsentry:masterfrom
pcbeingused333:fix/c2696-false-parameters
Nov 18, 2026
Merged

solnic merged 1 commit into
getsentry:masterfrom
pcbeingused333:fix/c2696-false-parameters

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Description

Named log parameters lose false during interpolation: with parameters: %{active: false}, the template active=%{active} renders as active=nil and the stored parameter is "nil" instead of false. The lookup used Map.get(params, atom_key) || Map.get(params, string_key), so a falsy atom-key value fell through to the (missing) string key.

The string key is now used as a default only when the atom key is absent, in both body interpolation and parameter collection. Atom keys keep precedence when both key forms are present.

Added a regression test in test/sentry/log_event_test.exs covering atom and string keys with false and atom-key precedence; it fails on master and passes with the fix (mix test test/sentry/log_event_test.exs, Elixir 1.18 / OTP 27).

Issues

None filed; found while reading Sentry.LogEvent.

This change was generated with assistance from Claude Code.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@solnic solnic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! ❤️ Freaking booleans! 😉

@solnic
solnic merged commit c488dcb into getsentry:master Nov 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants